package com.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.base.BaseDaoImpl;
import com.dao.UserDao;
import com.entity.VoteUser;

@Repository
public class UserDaoImpl extends BaseDaoImpl<VoteUser> implements UserDao {

	@Override
	public VoteUser getUserByLogin(String name, String pwd) {
		Query query = sf.getCurrentSession().createQuery("from VoteUser where username = ? and userpwd = ?");
		query.setParameter(0, name);
		query.setParameter(1, pwd);
		return (VoteUser) query.uniqueResult();
	}

	@Override
	public VoteUser getUserByName(String name) {
		Query query = sf.getCurrentSession().createQuery("from VoteUser where username = ?");
		query.setParameter(0, name);
		return (VoteUser) query.uniqueResult();
	}


}
